
<!DOCTYPE HTML>
<html lang="en" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>数学运算符 · InfluxDB中文文档</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="jasper">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-comment/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="authentication_and_authorization.html" />
    
    
    <link rel="prev" href="functions.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://legacy.gitbook.com/book/jasper-zhang1/influxdb" target="_blank" class="custom-link">InfluxDB中文文档</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../Introduction/">
            
                <a href="../Introduction/">
            
                    
                    介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../Introduction/installation.html">
            
                <a href="../Introduction/installation.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../Introduction/getting_start.html">
            
                <a href="../Introduction/getting_start.html">
            
                    
                    入门指南
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../Guide/">
            
                <a href="../Guide/">
            
                    
                    使用指南
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../Guide/writing_data.html">
            
                <a href="../Guide/writing_data.html">
            
                    
                    写入数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../Guide/querying_data.html">
            
                <a href="../Guide/querying_data.html">
            
                    
                    查询数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../Guide/downsampling_and_retention.html">
            
                <a href="../Guide/downsampling_and_retention.html">
            
                    
                    采样和数据保留
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../Guide/hardware_sizing.html">
            
                <a href="../Guide/hardware_sizing.html">
            
                    
                    硬件指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../Guide/https_setup.html">
            
                <a href="../Guide/https_setup.html">
            
                    
                    HTTPS设置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../Concepts/">
            
                <a href="../Concepts/">
            
                    
                    概念介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../Concepts/key_concepts.html">
            
                <a href="../Concepts/key_concepts.html">
            
                    
                    关键概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../Concepts/glossary.html">
            
                <a href="../Concepts/glossary.html">
            
                    
                    专业术语
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../Concepts/crosswalk.html">
            
                <a href="../Concepts/crosswalk.html">
            
                    
                    与SQL比较
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../Concepts/insights_tradeoffs.html">
            
                <a href="../Concepts/insights_tradeoffs.html">
            
                    
                    InfluxDB的设计见解和权衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../Concepts/schema_and_data_layout.html">
            
                <a href="../Concepts/schema_and_data_layout.html">
            
                    
                    schema设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../Concepts/storage_engine.html">
            
                <a href="../Concepts/storage_engine.html">
            
                    
                    存储引擎
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../Write_protocols/">
            
                <a href="../Write_protocols/">
            
                    
                    写入协议
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../Write_protocols/line_protocol.html">
            
                <a href="../Write_protocols/line_protocol.html">
            
                    
                    行协议
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="./">
            
                <a href="./">
            
                    
                    查询语言
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="data_exploration.html">
            
                <a href="data_exploration.html">
            
                    
                    数据查询语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="schema_exploration.html">
            
                <a href="schema_exploration.html">
            
                    
                    schema查询语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="database_management.html">
            
                <a href="database_management.html">
            
                    
                    数据库管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="continuous_queries.html">
            
                <a href="continuous_queries.html">
            
                    
                    连续查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="functions.html">
            
                <a href="functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6.6" data-path="math_operators.html">
            
                <a href="math_operators.html">
            
                    
                    数学运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="authentication_and_authorization.html">
            
                <a href="authentication_and_authorization.html">
            
                    
                    认证和授权
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../Troubleshooting/">
            
                <a href="../Troubleshooting/">
            
                    
                    故障排除
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../Troubleshooting/faq.html">
            
                <a href="../Troubleshooting/faq.html">
            
                    
                    FAQ
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../Troubleshooting/system_monitor.html">
            
                <a href="../Troubleshooting/system_monitor.html">
            
                    
                    系统监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../Troubleshooting/query_management.html">
            
                <a href="../Troubleshooting/query_management.html">
            
                    
                    查询管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../Troubleshooting/error_messages.html">
            
                <a href="../Troubleshooting/error_messages.html">
            
                    
                    错误信息
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >数学运算符</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;">&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;</h1>
<p>&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x9075;&#x5FAA;&#x6807;&#x51C6;&#x7684;&#x64CD;&#x4F5C;&#x987A;&#x5E8F;&#x3002;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#xFF0C;&#x5706;&#x62EC;&#x53F7;&#x4F18;&#x5148;&#x4E8E;&#x9664;&#x6CD5;&#x548C;&#x4E58;&#x6CD5;&#xFF0C;&#x800C;&#x4E58;&#x9664;&#x6CD5;&#x4F18;&#x5148;&#x4E8E;&#x52A0;&#x6CD5;&#x548C;&#x51CF;&#x6CD5;&#x3002;&#x4F8B;&#x5982;<code>5 / 2 + 3 * 2 = (5 / 2) + (3 * 2)</code>&#x548C;<code>5 + 2 * 3 - 2 = 5 + (2 * 3) - 2</code>&#x3002;</p>
<h2 id="&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;">&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;</h2>
<h3 id="&#x52A0;&#x6CD5;">&#x52A0;&#x6CD5;</h3>
<p>&#x52A0;&#x4E00;&#x4E2A;&#x5E38;&#x6570;&#x3002;</p>
<pre><code>SELECT &quot;A&quot; + 5 FROM &quot;add&quot;
SELECT * FROM &quot;add&quot; WHERE &quot;A&quot; + 5 &gt; 10
</code></pre><p>&#x4E24;&#x4E2A;&#x5B57;&#x6BB5;&#x76F8;&#x52A0;&#x3002;</p>
<pre><code>SELECT &quot;A&quot; + &quot;B&quot; FROM &quot;add&quot;
SELECT * FROM &quot;add&quot; WHERE &quot;A&quot; + &quot;B&quot; &gt;= 10
</code></pre><h3 id="&#x51CF;&#x6CD5;">&#x51CF;&#x6CD5;</h3>
<p>&#x51CF;&#x6CD5;&#x91CC;&#x5E26;&#x5E38;&#x6570;&#x3002;</p>
<pre><code>SELECT 1 - &quot;A&quot; FROM &quot;sub&quot;
SELECT * FROM &quot;sub&quot; WHERE 1 - &quot;A&quot; &lt;= 3
</code></pre><p>&#x4E24;&#x4E2A;&#x5B57;&#x6BB5;&#x505A;&#x51CF;&#x6CD5;&#x3002;</p>
<pre><code>SELECT &quot;A&quot; - &quot;B&quot; FROM &quot;sub&quot;
SELECT * FROM &quot;sub&quot; WHERE &quot;A&quot; - &quot;B&quot; &lt;= 1
</code></pre><h3 id="&#x4E58;&#x6CD5;">&#x4E58;&#x6CD5;</h3>
<p>&#x4E58;&#x4EE5;&#x4E00;&#x4E2A;&#x5E38;&#x6570;&#x3002;</p>
<pre><code>SELECT 10 * &quot;A&quot; FROM &quot;mult&quot;
SELECT * FROM &quot;mult&quot; WHERE &quot;A&quot; * 10 &gt;= 20
</code></pre><p>&#x4E24;&#x4E2A;&#x5B57;&#x6BB5;&#x76F8;&#x4E58;&#x3002;</p>
<pre><code>SELECT &quot;A&quot; * &quot;B&quot; * &quot;C&quot; FROM &quot;mult&quot;
SELECT * FROM &quot;mult&quot; WHERE &quot;A&quot; * &quot;B&quot; &lt;= 80
</code></pre><p>&#x4E58;&#x6CD5;&#x548C;&#x5176;&#x4ED6;&#x8FD0;&#x7B97;&#x7B26;&#x6DF7;&#x7528;&#x3002;</p>
<pre><code>SELECT 10 * (&quot;A&quot; + &quot;B&quot; + &quot;C&quot;) FROM &quot;mult&quot;
SELECT 10 * (&quot;A&quot; - &quot;B&quot; - &quot;C&quot;) FROM &quot;mult&quot;
SELECT 10 * (&quot;A&quot; + &quot;B&quot; - &quot;C&quot;) FROM &quot;mult&quot;
</code></pre><h3 id="&#x9664;&#x6CD5;">&#x9664;&#x6CD5;</h3>
<p>&#x9664;&#x6CD5;&#x91CC;&#x5E26;&#x5E38;&#x6570;&#x3002;</p>
<pre><code>SELECT 10 / &quot;A&quot; FROM &quot;div&quot;
SELECT * FROM &quot;div&quot; WHERE &quot;A&quot; / 10 &lt;= 2
</code></pre><p>&#x4E24;&#x4E2A;&#x5B57;&#x6BB5;&#x76F8;&#x9664;&#x3002;</p>
<pre><code>SELECT &quot;A&quot; / &quot;B&quot; FROM &quot;div&quot;
SELECT * FROM &quot;div&quot; WHERE &quot;A&quot; / &quot;B&quot; &gt;= 10
</code></pre><p>&#x9664;&#x6CD5;&#x548C;&#x5176;&#x4ED6;&#x8FD0;&#x7B97;&#x7B26;&#x6DF7;&#x7528;&#x3002;</p>
<pre><code>SELECT 10 / (&quot;A&quot; + &quot;B&quot; + &quot;C&quot;) FROM &quot;mult&quot;
</code></pre><h3 id="&#x6C42;&#x6A21;">&#x6C42;&#x6A21;</h3>
<p>&#x6A21;&#x4E00;&#x4E2A;&#x5E38;&#x6570;&#x3002;</p>
<pre><code>SELECT &quot;B&quot; % 2 FROM &quot;modulo&quot;
SELECT &quot;B&quot; FROM &quot;modulo&quot; WHERE &quot;B&quot; % 2 = 0
</code></pre><p>&#x4E24;&#x4E2A;&#x5B57;&#x6BB5;&#x6C42;&#x6A21;&#x3002;</p>
<pre><code>SELECT &quot;A&quot; % &quot;B&quot; FROM &quot;modulo&quot;
SELECT &quot;A&quot; FROM &quot;modulo&quot; WHERE &quot;A&quot; % &quot;B&quot; = 0
</code></pre><h3 id="&#x6309;&#x4F4D;&#x4E0E;">&#x6309;&#x4F4D;&#x4E0E;</h3>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x4EFB;&#x4F55;&#x6574;&#x6570;&#x548C;&#x5E03;&#x5C14;&#x503C;&#x4E2D;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x64CD;&#x4F5C;&#x7B26;&#xFF0C;&#x65E0;&#x8BBA;&#x662F;&#x5B57;&#x6BB5;&#x6216;&#x5E38;&#x6570;&#x3002;&#x8BE5;&#x64CD;&#x4F5C;&#x7B26;&#x4E0D;&#x652F;&#x6301;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x5B57;&#x7B26;&#x4E32;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x3002;&#x5E76;&#x4E14;&#x4E0D;&#x80FD;&#x6DF7;&#x5408;&#x4F7F;&#x7528;&#x6574;&#x6570;&#x548C;&#x5E03;&#x5C14;&#x503C;&#x3002;</p>
<pre><code>SELECT &quot;A&quot; &amp; 255 FROM &quot;bitfields&quot;
SELECT &quot;A&quot; &amp; &quot;B&quot; FROM &quot;bitfields&quot;
SELECT * FROM &quot;data&quot; WHERE &quot;bitfield&quot; &amp; 15 &gt; 0
SELECT &quot;A&quot; &amp; &quot;B&quot; FROM &quot;booleans&quot;
SELECT (&quot;A&quot; ^ true) &amp; &quot;B&quot; FROM &quot;booleans&quot;
</code></pre><h3 id="&#x6309;&#x4F4D;&#x6216;">&#x6309;&#x4F4D;&#x6216;</h3>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x4EFB;&#x4F55;&#x6574;&#x6570;&#x548C;&#x5E03;&#x5C14;&#x503C;&#x4E2D;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x64CD;&#x4F5C;&#x7B26;&#xFF0C;&#x65E0;&#x8BBA;&#x662F;&#x5B57;&#x6BB5;&#x6216;&#x5E38;&#x6570;&#x3002;&#x8BE5;&#x64CD;&#x4F5C;&#x7B26;&#x4E0D;&#x652F;&#x6301;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x5B57;&#x7B26;&#x4E32;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x3002;&#x5E76;&#x4E14;&#x4E0D;&#x80FD;&#x6DF7;&#x5408;&#x4F7F;&#x7528;&#x6574;&#x6570;&#x548C;&#x5E03;&#x5C14;&#x503C;&#x3002;</p>
<pre><code>SELECT &quot;A&quot; | 5 FROM &quot;bitfields&quot;
SELECT &quot;A&quot; | &quot;B&quot; FROM &quot;bitfields&quot;
SELECT * FROM &quot;data&quot; WHERE &quot;bitfield&quot; | 12 = 12
</code></pre><h3 id="&#x6309;&#x4F4D;&#x5F02;&#x6216;">&#x6309;&#x4F4D;&#x5F02;&#x6216;</h3>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x4EFB;&#x4F55;&#x6574;&#x6570;&#x548C;&#x5E03;&#x5C14;&#x503C;&#x4E2D;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x64CD;&#x4F5C;&#x7B26;&#xFF0C;&#x65E0;&#x8BBA;&#x662F;&#x5B57;&#x6BB5;&#x6216;&#x5E38;&#x6570;&#x3002;&#x8BE5;&#x64CD;&#x4F5C;&#x7B26;&#x4E0D;&#x652F;&#x6301;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x5B57;&#x7B26;&#x4E32;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x3002;&#x5E76;&#x4E14;&#x4E0D;&#x80FD;&#x6DF7;&#x5408;&#x4F7F;&#x7528;&#x6574;&#x6570;&#x548C;&#x5E03;&#x5C14;&#x503C;&#x3002;</p>
<pre><code>SELECT &quot;A&quot; ^ 255 FROM &quot;bitfields&quot;
SELECT &quot;A&quot; ^ &quot;B&quot; FROM &quot;bitfields&quot;
SELECT * FROM &quot;data&quot; WHERE &quot;bitfield&quot; ^ 6 &gt; 0
</code></pre><h3 id="&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x7684;&#x5E38;&#x89C1;&#x95EE;&#x9898;">&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x7684;&#x5E38;&#x89C1;&#x95EE;&#x9898;</h3>
<h4 id="&#x95EE;&#x9898;&#x4E00;&#xFF1A;&#x5E26;&#x6709;&#x901A;&#x914D;&#x548C;&#x6B63;&#x5219;&#x7684;&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;">&#x95EE;&#x9898;&#x4E00;&#xFF1A;&#x5E26;&#x6709;&#x901A;&#x914D;&#x548C;&#x6B63;&#x5219;&#x7684;&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;</h4>
<p>InfluxDB&#x5728;<code>SELECT</code>&#x8BED;&#x53E5;&#x4E2D;&#x4E0D;&#x652F;&#x6301;&#x6B63;&#x5219;&#x8868;&#x8FBE;&#x5F0F;&#x6216;&#x901A;&#x914D;&#x7B26;&#x3002;&#x4E0B;&#x9762;&#x7684;&#x67E5;&#x8BE2;&#x662F;&#x4E0D;&#x5408;&#x6CD5;&#x7684;&#xFF0C;&#x7CFB;&#x7EDF;&#x4F1A;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x9519;&#x8BEF;&#x3002;</p>
<p>&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x548C;&#x901A;&#x914D;&#x7B26;&#x4E00;&#x8D77;&#x4F7F;&#x7528;&#x3002;</p>
<pre><code>&gt; SELECT * + 2 FROM &quot;nope&quot;
ERR: unsupported expression with wildcard: * + 2
</code></pre><p>&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x548C;&#x5E26;&#x51FD;&#x6570;&#x7684;&#x901A;&#x914D;&#x7B26;&#x4E00;&#x8D77;&#x4F7F;&#x7528;&#x3002;</p>
<pre><code>&gt; SELECT COUNT(*) / 2 FROM &quot;nope&quot;
ERR: unsupported expression with wildcard: count(*) / 2
</code></pre><p>&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x548C;&#x6B63;&#x5219;&#x8868;&#x8FBE;&#x5F0F;&#x4E00;&#x8D77;&#x4F7F;&#x7528;&#x3002;</p>
<pre><code>&gt; SELECT /A/ + 2 FROM &quot;nope&quot;
ERR: error parsing query: found +, expected FROM at line 1, char 12
</code></pre><p>&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x548C;&#x5E26;&#x51FD;&#x6570;&#x7684;&#x6B63;&#x5219;&#x8868;&#x8FBE;&#x5F0F;&#x4E00;&#x8D77;&#x4F7F;&#x7528;&#x3002;</p>
<pre><code>&gt; SELECT COUNT(/A/) + 2 FROM &quot;nope&quot;
ERR: unsupported expression with regex field: count(/A/) + 2
</code></pre><h4 id="&#x95EE;&#x9898;&#x4E8C;&#xFF1A;&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x548C;&#x51FD;&#x6570;">&#x95EE;&#x9898;&#x4E8C;&#xFF1A;&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x548C;&#x51FD;&#x6570;</h4>
<p>&#x5728;&#x51FD;&#x6570;&#x91CC;&#x9762;&#x4F7F;&#x7528;&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x73B0;&#x5728;&#x4E0D;&#x652F;&#x6301;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF1A;</p>
<pre><code>SELECT 10 * mean(&quot;value&quot;) FROM &quot;cpu&quot;
</code></pre><p>&#x662F;&#x5141;&#x8BB8;&#x7684;&#xFF0C;&#x4F46;&#x662F;</p>
<pre><code>SELECT mean(10 * &quot;value&quot;) FROM &quot;cpu&quot;
</code></pre><p>&#x5C06;&#x4F1A;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x9519;&#x8BEF;&#x3002;</p>
<blockquote>
<p>InfluxQL&#x652F;&#x6301;&#x5B50;&#x67E5;&#x8BE2;&#xFF0C;&#x8FD9;&#x6837;&#x53EF;&#x4EE5;&#x8FBE;&#x5230;&#x51FD;&#x6570;&#x91CC;&#x9762;&#x4F7F;&#x7528;&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x76F8;&#x540C;&#x7684;&#x529F;&#x80FD;&#x3002;</p>
</blockquote>
<h2 id="&#x4E0D;&#x652F;&#x6301;&#x7684;&#x8FD0;&#x7B97;&#x7B26;">&#x4E0D;&#x652F;&#x6301;&#x7684;&#x8FD0;&#x7B97;&#x7B26;</h2>
<h3 id="&#x6BD4;&#x8F83;">&#x6BD4;&#x8F83;</h3>
<p>&#x5728;<code>SELECT</code>&#x4E2D;&#x4F7F;&#x7528;&#x4EFB;&#x610F;&#x7684;<code>=,!=,&lt;,&gt;,&lt;=,&gt;=,&lt;&gt;</code>&#xFF0C;&#x90FD;&#x4F1A;&#x8FD4;&#x56DE;&#x7A7A;&#x3002;</p>
<h3 id="&#x903B;&#x8F91;&#x8FD0;&#x7B97;&#x7B26;">&#x903B;&#x8F91;&#x8FD0;&#x7B97;&#x7B26;</h3>
<p>&#x4F7F;&#x7528;<code>!|,NAND,XOR,NOR</code>&#x90FD;&#x4F1A;&#x8FD4;&#x56DE;&#x89E3;&#x6790;&#x9519;&#x8BEF;&#x3002;</p>
<p>&#x6B64;&#x5916;&#xFF0C;&#x5728;&#x4E00;&#x4E2A;&#x67E5;&#x8BE2;&#x7684;<code>SELECT</code>&#x5B50;&#x53E5;&#x4E2D;&#x4F7F;&#x7528;<code>AND</code>&#x548C;<code>OR</code>&#x4E0D;&#x4F1A;&#x50CF;&#x6570;&#x5B66;&#x8FD0;&#x7B97;&#x7B26;&#x53EA;&#x4EA7;&#x751F;&#x7A7A;&#x7684;&#x7ED3;&#x679C;&#xFF0C;&#x56E0;&#x4E3A;&#x4ED6;&#x4EEC;&#x662F;InfluxQL&#x7684;&#x5173;&#x952E;&#x5B57;&#x3002;&#x7136;&#x800C;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x5BF9;&#x5E03;&#x5C14;&#x5B57;&#x6BB5;&#x4F7F;&#x7528;&#x6309;&#x4F4D;&#x8FD0;&#x7B97;<code>&amp;</code>&#xFF0C;<code>|</code>&#x548C;<code>^</code>&#x3002;</p>
<h3 id="&#x6309;&#x4F4D;&#x975E;">&#x6309;&#x4F4D;&#x975E;</h3>
<p>&#x6CA1;&#x6709;&#x6309;&#x4F4D;NOT&#x8FD0;&#x7B97;&#x7B26;&#xFF0C;&#x56E0;&#x4E3A;&#x4F60;&#x671F;&#x671B;&#x7684;&#x7ED3;&#x679C;&#x53D6;&#x51B3;&#x4E8E;&#x4F4D;&#x7684;&#x5BBD;&#x5EA6;&#x3002;InfluxQL&#x4E0D;&#x77E5;&#x9053;&#x4F4D;&#x7684;&#x5BBD;&#x5EA6;&#xFF0C;&#x6240;&#x4EE5;&#x65E0;&#x6CD5;&#x5B9E;&#x73B0;&#x9002;&#x5F53;&#x7684;&#x6309;&#x4F4D;NOT&#x8FD0;&#x7B97;&#x7B26;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x4F4D;&#x662F;8&#x4F4D;&#x7684;&#xFF0C;&#x90A3;&#x4E48;&#x4F60;&#x6765;&#x8BF4;&#xFF0C;1&#x4EE3;&#x8868;<code>0000 0001</code>&#x3002;</p>
<p>&#x6309;&#x4F4D;&#x975E;&#x672C;&#x5E94;&#x8BE5;&#x8FD4;&#x56DE;<code>1111 1110</code>&#xFF0C;&#x5373;&#x6574;&#x6570;254&#x3002;</p>
<p>&#x7136;&#x800C;&#xFF0C;&#x5982;&#x679C;&#x4F4D;&#x662F;16&#x4F4D;&#x7684;&#xFF0C;&#x90A3;&#x4E48;1&#x4EE3;&#x8868;<code>0000 0000 0000 0001</code>&#x3002;&#x6309;&#x4F4D;&#x975E;&#x672C;&#x5E94;&#x8BE5;&#x8FD4;&#x56DE;<code>1111 1111 1111 1110</code>&#xFF0C;&#x5373;&#x6574;&#x6570;65534&#x3002;</p>
<h4 id="&#x89E3;&#x51B3;&#x65B9;&#x6848;">&#x89E3;&#x51B3;&#x65B9;&#x6848;</h4>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>^</code>&#x52A0;&#x4F4D;&#x6570;&#x7684;&#x6570;&#x503C;&#x6765;&#x5B9E;&#x73B0;&#x6309;&#x4F4D;&#x975E;&#x7684;&#x6548;&#x679C;&#xFF1A;</p>
<p>&#x5BF9;&#x4E8E;8&#x4F4D;&#x7684;&#x6570;&#x636E;&#xFF1A;</p>
<pre><code>SELECT &quot;A&quot; ^ 255 FROM &quot;data&quot;
</code></pre><p>&#x5BF9;&#x4E8E;16&#x4F4D;&#x6570;&#x636E;&#xFF1A;</p>
<pre><code>SELECT &quot;A&quot; ^ 65535 FROM &quot;data&quot;
</code></pre><p>&#x5BF9;&#x4E8E;32&#x4F4D;&#x6570;&#x636E;&#xFF1A;</p>
<pre><code>SELECT &quot;A&quot; ^ 4294967295 FROM &quot;data&quot;
</code></pre><p>&#x91CC;&#x9762;&#x7684;&#x6BCF;&#x4E00;&#x4E2A;&#x5E38;&#x6570;&#x7684;&#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#x4E3A;<code>(2 ** width) - 1</code>&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="functions.html" class="navigation navigation-prev " aria-label="Previous page: 函数">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="authentication_and_authorization.html" class="navigation navigation-next " aria-label="Next page: 认证和授权">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"数学运算符","level":"1.6.6","depth":2,"next":{"title":"认证和授权","level":"1.6.7","depth":2,"path":"Query_language/authentication_and_authorization.md","ref":"Query_language/authentication_and_authorization.md","articles":[]},"previous":{"title":"函数","level":"1.6.5","depth":2,"path":"Query_language/functions.md","ref":"Query_language/functions.md","articles":[]},"dir":"ltr"},"config":{"plugins":["comment"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"comment":{"highlightCommented":true},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"github":"jasper-zhang/influxdb-document-cn","theme":"default","author":"jasper","pdf":{"pageNumbers":true,"fontSize":16,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"InfluxDB中文文档","language":"en","links":{"sidebar":{"InfluxDB中文文档":"https://legacy.gitbook.com/book/jasper-zhang1/influxdb"},"gitbook":true},"gitbook":"*","description":""},"file":{"path":"Query_language/math_operators.md","mtime":"2019-09-29T09:05:38.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-09-29T09:10:37.143Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-comment/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

